<?php
/**
 * Created by PhpStorm.
 * User: root
 * Date: 8/11/14
 * Time: 11:53 AM
 */

namespace Admin\Form\Category;
use Zend\Form\Form;
use Zend\Form\Element;
use Base\Form\ProvidesEventsForm;
use Zend\Stdlib\Hydrator\ClassMethods as ClassMethodsHydrator;
use Zend\ServiceManager\ServiceLocatorInterface;

class CreateCategoryForm extends ProvidesEventsForm
{
    protected  $serviceLocator;
    public function init()
    {
        $this->add(array(
            'type' => 'create_category_fieldset',//'Admin\Form\Category\CreateCategoryFieldset',
            /*'options' => array(
                'use_as_base_fieldset' => true,
            ),*/

        ));

        $submitElement = new Element\Button('submit');
        $submitElement
            ->setLabel('Submit')
            ->setAttributes(array(
                'type'  => 'submit',
                'class' => 'btn btn-primary',
                'icon'    => '<i class="fa fa-angle-right"></i>',
            ));

        $this->add($submitElement, array(
            'priority' => -100,
        ));


        $this->get('submit')->setLabel('Create category');
        $this->getEventManager()->trigger('init', $this);
    }

    /*
    public function __construct($name , ServiceLocatorInterface $serviceLocator)
    {
        //$this->setRegistrationOptions($options);
        $this->serviceLocator = $serviceLocator;

        parent::__construct();

        //$createCategoryFieldsetService = $this->serviceLocator->get('create_category_fieldset');

        //$createCategoryFieldset = new CreateCategoryFieldset();
        //die(print_r($createCategoryFieldset));
        //$a = new \Admin\Form\Category\CreateCategoryFieldset();
        //die(print_r($a));

        $this->add(array(
            'type' => 'create_category_fieldset',//'Admin\Form\Category\CreateCategoryFieldset',
            /*'options' => array(
                'use_as_base_fieldset' => true,
            ),*/
        /*
        ));

        $submitElement = new Element\Button('submit');
        $submitElement
            ->setLabel('Submit')
            ->setAttributes(array(
                'type'  => 'submit',
                'class' => 'btn btn-primary',
                'icon'    => '<i class="fa fa-angle-right"></i>',
            ));

        $this->add($submitElement, array(
            'priority' => -100,
        ));


        $this->get('submit')->setLabel('Create category');
        $this->getEventManager()->trigger('init', $this);
    }*/

} 